package com.cheerscpl.protocol.model;

import java.io.Serializable;
import java.util.Date;

/**
 * Created by chenpuliang on 2017/6/4.
 */
public class DataPacket implements Serializable{

    private static final long serialVersionUID = 3702197712723210911L;

    private final String devId;
    private final Date date;
    private final Integer length;
    private final String fid;
    private final String msgId;

    public DataPacket(final String devId, final Date date, final Integer length,
                      final String fid, final String msgId) {
        this.devId = devId;
        this.date = date;
        this.length = length;
        this.fid = fid;
        this.msgId = msgId;
    }

    public static class DataPacketBuilder {

        private String devId;
        private Date date;
        private Integer length;
        private String fid;
        private String msgId;

        public DataPacketBuilder() {
        }

        public DataPacketBuilder devId(String devId){
            this.devId = devId;
            return this;
        }

        public DataPacketBuilder date(Date date){
            this.date = date;
            return this;
        }

        public DataPacketBuilder length(Integer length) {
            this.length = length;
            return this;
        }

        public DataPacketBuilder fid(String fid) {
            this.fid = fid;
            return this;
        }

        public DataPacketBuilder msgId(String msgId) {
            this.msgId = msgId;
            return this;
        }

        public DataPacket build(){
            return new DataPacket(
                    devId,date,length,fid,msgId
            );
        }
    }

    public String getDevId() {
        return devId;
    }

    public Date getDate() {
        return date;
    }

    public Integer getLength() {
        return length;
    }

    public String getFid() {
        return fid;
    }

    public String getMsgId() {
        return msgId;
    }
}
